package com.bjb.vr.manager.controller;

import com.bjb.vr.common.ao.OptClassifyAo;
import com.bjb.vr.common.ao.OptFeatureAo;
import com.bjb.vr.common.ao.OptTopicAo;
import com.bjb.vr.common.ao.ResContentAo;
import com.bjb.vr.common.result.BaseResult;
import com.bjb.vr.manager.service.HttpOperationService;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description: 云端资源配置
 * @author: hujingbo
 * @create: 2022-12-14 16:32
 **/
@RestController
@RequestMapping("/api/manager/v1")
public class CloudResourceController {

    @Resource
    private HttpOperationService httpOperationService;


    /**
     * 查询推荐位列表数据
     *
     * @param optFeatureAo
     * @return
     */
    @PostMapping("/queryFeatureList")
    public BaseResult queryFeatureList(@RequestBody OptFeatureAo optFeatureAo) {
        return httpOperationService.queryFeatureList(optFeatureAo);
    }

    /**
     * 查询资源详情
     *
     * @param resContentAo
     * @return
     */
    @PostMapping("/queryResourcesOne")
    public BaseResult queryResDetail(@RequestBody ResContentAo resContentAo) {
        Assert.notNull(resContentAo.getId(), "资源主键ID不能为空");
        return httpOperationService.queryResourcesOne(resContentAo);
    }

    /**
     * 查询分类推荐列表数据
     *
     * @param optClassifyAo
     * @return
     */
    @PostMapping("/queryClassifyList")
    public BaseResult queryClassifyList(@RequestBody OptClassifyAo optClassifyAo) {
        return httpOperationService.queryClassifyList(optClassifyAo);
    }

    /**
     * 查询资源列表
     *
     * @param resContentAo
     * @return
     */
    @PostMapping("/queryResourcesList")
    public BaseResult queryResourcesList(@RequestBody ResContentAo resContentAo) {
        return httpOperationService.queryResourcesList(resContentAo);
    }

    /**
     * 查询专题推荐列表数据
     *
     * @param optTopicAo
     * @return
     */
    @PostMapping("/queryTopicList")
    public BaseResult queryTopicList(@RequestBody OptTopicAo optTopicAo) {
        optTopicAo.setNeedTopicRes(true);
        return httpOperationService.queryTopicList(optTopicAo);
    }
}
